using System.ComponentModel.DataAnnotations;

namespace AiQiuQuan.Sport.Model.Models
{
    /// <summary>
    /// 修改教练dto
    /// </summary>
    public class CoacherSimpleUpdateDto : IValidatableObject
    {
        /// <summary>
        /// ID
        /// </summary>
        [Required]
        public Guid ID { get; set; }

        /// <summary>
        /// 图片
        /// </summary>
        public string? PicUrl { get; set; }

        /// <summary>
        /// 介绍
        /// </summary>
        public CoacherIntroductionDto? Introduction { get; set; }

        /// <summary>
        /// validate
        /// </summary>
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (string.IsNullOrWhiteSpace(PicUrl) && Introduction == null)
            {
                yield return new ValidationResult("图片、介绍至少传一个");
                yield break;
            }
        }
    }
}
